package com.oceanread.cn.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oceanread.cn.entity.User;
import com.oceanread.cn.mapper.UserMapper;
import com.oceanread.cn.service.IUserService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IUserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    public User login(String username) {
        return baseMapper.loginUser(username);
    }
    public User insert(String username,String password){
        return baseMapper.insertUser(username,password);
    }
    public List<User> getall() {
        return baseMapper.getall();
    }

    @Override
    public List<User> getTablelist(int page, int size) {
        return baseMapper.getTablelist((page - 1) * size, size);
    }

    @Override
    public Integer getnum() {
        return baseMapper.getnum();
    }

    @Override
    public Integer getnumquery(String key, String value) {
        return baseMapper.getnumquery(key, value);
    }
    @Override
    public Integer update(User user) {
        return baseMapper.update(user.getId(),user.getUsername(),user.getRole());
//                user.getPassword(),
    }
    @Override
    public Integer delete(int id) {
        return baseMapper.delete(id);
    }
}
